<?php
/*
	首页
*/

defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
if($_RQ['op']=='get'){
	$set=$this->plugin_setting('basic');
	$setting=$this->plugin_setting('basic');
	$return['set']=$set;
	$return['shopset']=$this->plugin_setting('shopset');
	$keywords=$this->plugin_setting('search')['keyword'];
	$return['keywords']=explode(';',$keywords);
	//print_r($keywords);exit;
	$return['list']=array();
	$return['indexpai']=array();
	if($return['setting']['issearch']){
		$return['indexpai'][]=array('name'=>'search');
	}
	if($return['setting']['ishdps']){
		$return['indexpai'][]=array('name'=>'hdps');
	}
	if($return['setting']['isbankuai1']){
		$return['indexpai'][]=array('name'=>'bankuai1');
	}
	if($return['setting']['bankuai2']){
		$return['indexpai'][]=array('name'=>'bankuai2');
	}
	if($return['setting']['cube']){
		$return['indexpai'][]=array('name'=>'cube');
	}
	if($return['setting']['share']){
		$return['indexpai'][]=array('name'=>'share');
	}
	$return['indexpai'][]=array('name'=>'goods');
	//推荐商品
	$indexrecommands=pdo_getall('jy_weishop_goods',array('uniacid'=>$_SESSION['uniacid'],'saletype like'=>'%;1;%'),array('id','title','image','price','total'));
	$return['indexrecommands']=$indexrecommands;
	//商品分类
	$p_group=pdo_getall('jy_weishop_goods_group',array('uniacid'=>$_SESSION['uniacid'],'isshow'=>'1','parentid'=>'0'),'','paixu asc');
	//子分类
	$params=array('uniacid'=>$_SESSION['uniacid'],'status'=>1);
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$total='';
	if($p_group){
		foreach($p_group as &$item){
			$item['c_group']=pdo_getall('jy_weishop_goods_group',array('uniacid'=>$_SESSION['uniacid'],'isshow'=>'1','parentid'=>$item['id']),'','paixu asc');
			$item['goodslist']=pdo_getslice('jy_weishop_goods',array('uniacid'=>$_SESSION['uniacid'],'status'=>1,'pcate'=>$item['id']),array($pindex,$psize),$total,$fields,'','paixu desc');
			if($item['c_group']){
				foreach($item['c_group'] as &$row){
					$params['ccate']=$row['id'];
					$row['goods']=pdo_getslice('jy_weishop_goods',$params,array($pindex,$psize),$total,$fields,'','paixu desc');
				}
			}
		}
	}
	$return['p_group']=$p_group;
	//获取用户信息
	$user=pdo_get('core_members',array('uniacid'=>$_SESSION['uniacid'],'id'=>$_SESSION['uid']));
	$return['user']=$user;
	$return['login']=$user?1:2;
	$return['top_adv']=show_adv($set,'top',1200,90,'_blank');
	$return['logo_adv']=show_adv($set,'logo',1200,90,'_blank');
	$return['right_adv']=show_adv($set,'top',230,165,'_blank');
	$return['middle_adv']=show_adv($set,'top',1200,90,'_blank');
	$return['bottom_adv']=show_adv($set,'top',1200,90,'_blank');
	exi($return);
}
?>